﻿using System;
using System.ComponentModel;
using System.Linq;
using ProjectEuler.Extensions;
using ProjectEuler.Linq;

namespace ProjectEuler.Problems
{
    [EulerProblem(42, 162)]
    [Description("How many triangle words does the list of common English words contain?")]
    internal sealed class Problem042 : EulerProblem
    {
        public override Object Solve()
        {
            using (var reader = OpenTextAttachment())
            {
                return (from word in reader.ReadAllLines()
                        select word.NumberValue()).Count(n => n.IsTriangular());
            }
        }   
    }
}
